import request from '@/utils/request'
import type {categoryResponseData,attrResponseData,attrModel} from './model/attr';
enum API{
    C1='/admin/product/getCategory1',
    C2='/admin/product/getCategory2/',
    C3='/admin/product/getCategory3/',
    ATTR='/admin/product/attrInfoList/',
    ADDORUPDATAATTR='/admin/product/saveAttrInfo',
    DELETE='/admin/product/deleteAttr/'
}
export const reqC1List=()=>request.get<any,categoryResponseData>(API.C1)
export const reqC2List=(category1Id:number|string)=>request.get<any,categoryResponseData>(API.C2+category1Id)
export const reqC3List=(category2Id:number|string)=>request.get<any,categoryResponseData>(API.C3+category2Id)

export const reqAttrList=(category1Id:number|string,category2Id:number|string,category3Id:number|string)=>request.get<any,attrResponseData>(API.ATTR+`${category1Id}/${category2Id}/${category3Id}`)
export const reqAddorUpdatartte=(data:attrModel)=>request.post(API.ADDORUPDATAATTR,data)
export const reqDeleteAttr=(attrId:number)=>request.delete<any,any>(API.DELETE+`${attrId}`)